<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>列表渲染</title>
</head>

<body>
    <div id="root">
        <!-- 普通数组遍历 -->
        <h2>普通数组遍历</h2>
        <ul>
            <li v-for="(v,k) in arr" ::key="k">{{k}}---{{v}}</li>
        </ul>
        <!-- 对象数组遍历 -->
        <h2>对象数组遍历</h2>
        <ul>
            <li v-for="(v,k) in personList" :key="v.id">{{k}}---{{v.name}}---{{v.age}}--{{v.sex}}</li>
        </ul>
        <!-- 对象成员遍历     -->
        <h2>对象成员遍历</h2>
        <ul>
            <li v-for="(v,k) of person" :key="k">{{k}}---{{v}}</li>
        </ul>
        <!-- 有限次数遍历 -->
        <h2>有限次数遍历</h2>
        <ul>
            <li v-for="(v,k) in 10" >{{k}}---{{v}}</li>
        </ul>
    </div>

    <script>
        new Vue({
            el: '#root',
            data: {
                arr: ['张三', '李四', '王五'],
                personList: [
                    { id:'003',name: '张三', age: 15, sex: '女' },
                    { id:'005',name: '李四', age: 15, sex: '男' },
                    { id:'009',name: '王五', age: 15, sex: '女' }
                ],
                person:{
                    id:'001',
                    name: '张三', 
                    age: 15, 
                    sex: '女' 
                }
            }
        })
    </script>
</body>

</html>